<template>
  <j-modal
    title="人员转移"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="form" :rules="validatorRules">
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" class="fyb">
          <a-checkbox @change="onChange">添加负样本库</a-checkbox>
        </a-form-model-item>
        <a-form-model-item label="标签" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="label">
          <a-select style="width:100%" v-model="form.label" placeholder="请选择">
            <template v-for="(value, key) in labelData">
              <a-select-option :key="key" :value="key" @click.native="onLabelData(key, value)">
                {{ value }}
              </a-select-option>
            </template>
          </a-select>
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>

<script>
// import * as alarmApi from '@/api/alarm.js'
export default {
  name: 'HandleModal',
  components: {},
  data() {
    return {
      labelCol: {
        xs: { span: 10 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 10 },
        sm: { span: 16 }
      },
      width: 600,
      visible: false,
      form: {
        dealBy: '',
        dealContent: '',
        id: ''
      },
      disableSubmit: false,
      confirmLoading: false,
      id: '',
      validatorRules: {
        label: [{ required: true, message: '请选择标签!' }]
      },
      labelData: ['标签1', '标签2', '标签3']
    }
  },
  async created() {},
  methods: {
    init() {},
    show(id) {
      this.form.id = id
      this.form.dealContent = ''
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    onChange(e) {
      console.log(`checked = ${e.target.checked}`)
    },
    onLabelData(key, value) {},
    handleOk() {
      // this.$refs.form.validate((valid) => {
      //   if (valid) {
      //     this.confirmLoading = true
      //     alarmApi.smuInfoWarnEdit(this.form)
      //       .then((res) => {
      //         if (res.success) {
      //           this.$message.success(res.message)
      //           this.$emit('ok')
      //         } else {
      //           this.$message.warning(res.message)
      //         }
      //       })
      //       .catch((e) => {
      //         this.$message.warn('请求失败！')
      //       })
      //       .finally(() => {
      //         this.confirmLoading = false
      //         this.close()
      //       })
      //   }
      // })
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
<style lang="less" scoped>
.fyb {
  /deep/.ant-col-sm-16 {
    margin-left: 12%;
  }
}
</style>
